//
//  ViewController.m
//  lzzHHHH
//
//  Created by lanou3g on 15/12/8.
//  Copyright (c) 2015年 hy. All rights reserved.
//

#import "ViewController.h"
#import "UserLoadViewController.h"
@interface ViewController ()<UIScrollViewDelegate>
{
    NSArray *arr;
    WHYTabBarView *whyTabBarView;
}
@property (weak, nonatomic) IBOutlet UIView *UpView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self scrollViewChange];
    
//    UIBarButtonItem *left = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"yonghu.png"] style:UIBarButtonItemStyleDone target:self action:@selector(barButtonItemAction)];
//    self.navigationItem.leftBarButtonItem = left;
}

//-(void)barButtonItemAction{
//    UserLoadViewController *userLoad = [[UserLoadViewController alloc]init];
//    [self.navigationController presentViewController:userLoad animated:YES completion:nil];
//}

-(void)scrollViewChange{
    viewWidth=self.view.frame.size.width;
    viewHeight=self.view.frame.size.height;
    // Do any additional setup after loading the view, typically from a nib.
    arr = [NSArray arrayWithObjects:@"推荐",@"视频",@"图片",@"段子",@"订阅",@"精华",@"同城",@"段友圈" ,nil];
    whyTabBarView = [[WHYTabBarView alloc]initWithFrame:self.UpView.frame withWidth:viewWidth-15 withHeight:viewHeight withArray:arr];
    [self.view addSubview:whyTabBarView];
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deliverVelue:) name:@"123" object:nil];
    self.scrollViewDown.delegate = self;
}

- (void)deliverVelue:(NSNotification *)notification{
    NSString *str= [notification object];
    NSLog(@"%@",str);
    CGFloat tmp=[str intValue];
    self.scrollViewDown.contentOffset = CGPointMake((viewWidth)*tmp, 0);
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    [whyTabBarView chuanZhi:scrollView];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
